#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    dlg = new MyCaculateDialog();
    dlg->show();
}

/**
 * @brief MainWindow::on_pushButton_2_clicked
 *
 * 代码创建一个对话框
 */
void MainWindow::on_pushButton_2_clicked()
{
    dlg2 = new QDialog(this);

    QSize size(200,200);

    dlg2->setFixedSize(size);
    dlg2->show();
}

void MainWindow::on_pushButton_3_clicked()
{
    ldlg = new LoginFormDialog(this);
    ldlg->show();
}

void MainWindow::on_pushButton_4_clicked()
{
    picDlg = new PicturePaintDialog(this);
    picDlg->show();
}

void MainWindow::on_pushButton_5_clicked()
{

    fileSelect = new FileSelectDialog(this);
    fileSelect->show();
}

void MainWindow::mousePressEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton){

        QMessageBox box(this);
        box.setIcon(QMessageBox::Information);
        box.setWindowTitle("信息");
        box.setText("鼠标左键被按下");
        box.exec();
    }else if(event->button() == Qt::RightButton){
        QMessageBox box(this);
        box.setIcon(QMessageBox::Information);
        box.setWindowTitle("信息");
        box.setText("鼠标右键被按下");
        box.exec();
    }else{
        QMessageBox box(this);
        box.setIcon(QMessageBox::Information);
        box.setWindowTitle("信息");
        box.setText("鼠标右键被按下");
        box.setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel);
        box.exec();
    }
}

void MainWindow::mouseReleaseEvent(QMouseEvent *event)
{

}

void MainWindow::mouseMoveEvent(QMouseEvent *event)
{

}
